package com.myaihui.service.impl;

import com.myaihui.domain.Order;
import com.myaihui.foundation.DO.OrderPageDO;
import com.myaihui.foundation.model.Pager;
import com.myaihui.foundation.query.OrderQuery;
import com.myaihui.repository.OrderRepository;
import com.myaihui.repository.base.OrderLinkRepository;
import com.myaihui.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2018/7/19
 * *******************************
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderLinkRepository orderLinkRepository;

    @Override
    public Pager<OrderPageDO> findByConditions(OrderQuery query) {
        List<OrderPageDO> pageDOList = orderLinkRepository.findByConditions(query);
        Long count = orderLinkRepository.countByConditions(query);
        return new Pager<OrderPageDO>(query, count, pageDOList);
    }
}
